package com.ocom.company.feign;

import com.ocom.common.constant.ActivitiUrl;
import com.ocom.common.request.activiti.ApplySaveRequest;
import com.ocom.common.request.activiti.HandleTasksRequest;
import com.ocom.common.request.activiti.PendingTasksRequest;
import com.ocom.common.resp.Result;
import com.ocom.common.vo.activiti.IncompleteTaskVO;
import com.ocom.common.vo.activiti.PageResultVo;
import com.ocom.common.vo.activiti.SearchFlowVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Component
@FeignClient(value = "activiti")
public interface ActivitiClientService {

    @PostMapping(ActivitiUrl.URL_getProcessInfo)
    Result<List<SearchFlowVo>> getProcessInfo(@RequestParam(value = "businessKey")String businessKey,
                                                     @RequestParam(value = "processInstanceId",required = false)String processInstanceId);

    @PostMapping(ActivitiUrl.URL_OcomSubmitApply)
    Result<Map<String,Object>> submitApply(@RequestBody ApplySaveRequest applySaveRequest);

    @PostMapping(ActivitiUrl.URL_OcomHandleTask)
    public Result<HashMap> handleTask(@RequestBody HandleTasksRequest request);

    @PostMapping(ActivitiUrl.URL_OcomCancelTask)
    public Result<Boolean> cancelApply(@RequestParam(value = "processDefinitionKey") String processDefinitionKey,@RequestParam(value = "businessKey") String businessKey);


    @PostMapping(ActivitiUrl.URL_OcomPendingTasks)
    Result<PageResultVo<IncompleteTaskVO>> pendingTasks(@RequestBody PendingTasksRequest pendingTasksRequest);

}
